home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl
-
- my $SYSVERS = "$ARGV[3]"."/System/Library/CoreServices/SystemVersion.plist";
- ##################
-
- sub CheckVersion
- {
- my $path = $_[0];
- my $version = $_[1];
- my $keyName = $_[2];
- my $operator = $_[3];
-
- if (! -e $path) {
- return 0;
- }
-
- if (!$operator) {
- $operator = "==";
- }
-
- my $oldSeperator = $/;
- $/ = \0;
-
- open( PLIST, "$path") || do {
- return 0;
- };
-
- $plistData = <PLIST>;
- $plistData =~ /<dict>(.*?)<\/dict>/gis;
-
- @items = split(/<key>/, $plistData);
-
- shift @items;
- foreach $item (@items) {
- $item =~ /(.*?)<\/key>.*?<string>(.*?)<\/string>/gis;
- $versiondata{ $1 } = $2;
- }
-
- close(PLIST);
-
- $/ = $oldSeperator;
-
- @theVersionArray = split(/\./, $versiondata{$keyName});
- for ($i = 0; $i < 3; $i++) {
- if(!$theVersionArray[$i]) {
- $theVersionArray[$i] = '0';
- }
- }
-
- @versionArray = split(/\./, $version);
-
- my $actualVersion;
-
- for ($i = 0; $i < 3; $i++) {
- if (($theVersionArray[$i] != $versionArray[$i]) or ($i == 2)) {
-
- $actualVersion = $theVersionArray[$i];
- $version = $versionArray[$i];
-
- last;
- }
- }
-
- my $expression = '$actualVersion ' . $operator . ' $version';
- if( eval ($expression) )
- {
- return 1;
- }
- else
- {
- return 0;
- }
-
- }
-
-
- ########################################
-
- my $runnerPID = getppid();
- my $installerPID = "";
- my $uid = "";
- my $uname = "";
-
- open( PSOUT, "/bin/ps -axww -o pid,ppid -p $runnerPID |" );
- while( <PSOUT> ) {
- my @fields = split '\s+', $_;
- if ("$fields[1]" eq "$runnerPID") {
- $installerPID = $fields[2];
- }
- }
- close( PSOUT );
-
- if ("$installerPID" ne "") {
- open( PSOUT, "/bin/ps -axww -o pid,ruid -p $installerPID |" );
- while( <PSOUT> ) {
- my @fields = split '\s+', $_;
- if ("$fields[1]" eq "$installerPID") {
- $uid = $fields[2];
- }
- }
- close( PSOUT );
- }
-
- if ("$uid" ne "") {
- open( PSOUTA, "/usr/bin/id -p $uid |" );
- while( <PSOUTA> ) {
- my @fields = split '\s+', $_;
- if ("$fields[0]" eq "uid") {
- $uname = $fields[1];
- }
- }
- close( PSOUTA );
- }
-
- # Marketing (aka Amy Fazio) sez we don't need to bring up the registration dialog anymore
- # but let's just comment it out for now in case they change their minds. - duano! 3/16/04
- # Yup, they changed their minds. We do not need the registration anymore, but we still need
- # to put up the warning that they are about to lose their pro key. -dennis 2/10/05
- if ("$ENV{COMMAND_LINE_INSTALL}" ne "1" && "$ENV{SOFTWARE_UPDATE}" ne "YES") {
- my $ALERT_APP = "$ARGV[0]" . "/Contents/Resources/QT6Installer.app/Contents/MacOS/QT6Installer";
- my $EXIT_VALUE = 0;
-
- my $cmd = "\"$ALERT_APP\" ";
- if ("$uname" ne "") {
- $cmd = "sudo -u $uname \"$ALERT_APP\" ";
- }
-
- $EXIT_VALUE = system("$cmd");
-
- if (($EXIT_VALUE >> 8) != 0) {
- if ("$installerPID" ne "") {
- kill "QUIT", $installerPID;
- }
- kill "QUIT", $runnerPID;
- exit($EXIT_VALUE >> 8);
- }
- }
-
- ########
-
- my $CLEANUP_PREFS = "$ARGV[0]" . "/Contents/Resources/CleanPrefs";
-
- my $cmd = "\"$CLEANUP_PREFS\"";
- if ("$uname" ne "") {
- $cmd = "sudo -u $uname \"$CLEANUP_PREFS\"";
- }
- system("$cmd");
-
- my $QUICKTIME_VERS = "/System/Library/Frameworks/QuickTime.framework/Versions/A/Resources/version.plist";
-
- my $Delete = "$ARGV[0]" . "/Contents/Resources/deleteomatic";
- my $DELETED_FILES="$ARGV[0]" . "/Contents/Resources/cleanup-list";
-
- my $QuickTime_h = "QuickTime.h";
- my $Movies_h = "Movies.h";
-
- my $destinationBase = "$ARGV[3]" . "/System/Library/Frameworks/QuickTime.framework/Versions/A/Headers/";
- my $sourceBase = "$ARGV[0]" . "/Contents/Resources";
-
- ###########
-
- my $devtools_check1 = "/Library/Receipts/DeveloperTools.pkg";
- my $devtools_check2 = "/Library/Receipt/DevTools.pkg";
- my $sdk_folder = "/Developer/SDKs";
- my $Headers_PKG= "$ARGV[0]" . "/Contents/Resources/QuickTime7Headers.pkg";
-
- # remove the quicktime headers if quicktime is less than 7.0 and they have not read the license
- if (CheckVersion("$QUICKTIME_VERS", "7.0", "CFBundleVersion", "<")) {
- if ( ! -e "/System/Library/Frameworks/QuickTime.framework/Versions/A/Headers/.qtheaderversion") {
- system ("$Delete \"$ARGV[2]\" \"$DELETED_FILES\"");
- # check if they are a quicktime developer
- if ((-e $devtools_check1) or (-e $devtools_check2)) {
-
- # drop the mini installer
- if (! -e $sdk_folder) {
- system("/bin/mkdir \"$sdk_folder\"");
- }
- system("/bin/cp -rf \"$Headers_PKG\" \"$sdk_folder/\"");
-
- #Replace with dummy headers
- system("/bin/cp -f \"$sourceBase/$QuickTime_h\" \"$destinationBase/$QuickTime_h\"");
- system("/bin/cp -f \"$sourceBase/$Movies_h\" \"$destinationBase/$Movies_h\"");
-
- }
-
- }
- }
-
-
-
-